package com.augurit.smartform.service;

import java.util.List;
import java.util.Map;

import javax.script.ScriptEngine;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springside.modules.orm.Page;

public interface IFormExecuteService {
	
	/**
	 * 查找并执行后端标签JAVASCRIPT脚本
	 * @param engine
	 * @param request
	 * cuigeqiang
	 */
	public Object executeTagServer(ScriptEngine engine,HttpServletRequest request);
	
	/**
	 * 查找并执行后端页面JAVASCRIPT脚本
	 * @param engine
	 * @param request
	 * cuigeqiang
	 */
	public void executePageServer(ScriptEngine engine,HttpServletRequest request);
	
	/**
	 * 查找并执行后端工作流保存之前JAVASCRIPT脚本
	 * @param engine
	 * @param request
	 * cuigeqiang
	 */
	public void executeWfSaveServer(ScriptEngine engine,HttpServletRequest request);
	
	/**
	 * 保存表单数据
	 * @param request
	 * cuigeqiang
	 */
	public List<Long> saveForm(HttpServletRequest request);
	
	/**
	 * 保存从表数据
	 * @param request
	 * cuigeqiang
	 */
	public List<Long> saveSlaveForm(HttpServletRequest request);
	
	/**
	 * 查询表单数据
	 * @param page
	 * @param request
	 * cuigeqiang
	 */
	public void search(Page<Map> page,HttpServletRequest request);
	
	/**
	 * 得到默认值放入MAP中
	 * @param request
	 * @return
	 * cuigeqiang
	 */
	public Map<String,Object> getDefaultMap(HttpServletRequest request);
	
	/**
	 * 从后台加载修改表单的数据
	 * @param pageMap
	 * @param request
	 * cuigeqiang
	 */
	public void loadUpdateData(Map pageMap,HttpServletRequest request);
	
	/**
	 * 通过ID和PAGECODE从后台加载表单的数据
	 * @param pageMap
	 * @param request
	 * cuigeqiang
	 */
	public void loadDataByPageCodeAndId(Map<String,Object> pageMap,String id,String pageCode);
	
	/**
	 * 通过ID和PAGECODE从后台加载表单的汇总字段数据（工作流相关）
	 * @param pageMap
	 * @param id
	 * @param pageCode
	 * cuigeqiang
	 */
	public void loadSummaryDataByPageCodeAndId(Map<String,Object> summaryMap,String id,String pageCode);
	
	/**
	 * 得到包含OPTION的MAP
	 * @param request
	 * @return
	 * cuigeqiang
	 */
	public Map<String,Object> getOptionMap(HttpServletRequest request);
	
	/**
	 * 保存表单数据
	 * @param request
	 * cuigeqiang
	 */
	public List<Long> updateForm(HttpServletRequest request);
	
	/**
	 * 删除表单数据
	 * @param request
	 * cuigeqiang
	 */
	public void deleteFormByCheckedIds(HttpServletRequest request);
	
	/**
	 * 删除表单数据
	 * @param request
	 * cuigeqiang
	 */
	public void deleteForm(HttpServletRequest request);
	
	/**
	 * 跳转到指定页面
	 * @param response
	 * @param pageCode
	 * cuigeqiang
	 */
	public void openPageByCode(HttpServletResponse response,String pageCode);
	
	/**
	 * 根据父表单查询子表单ID
	 * @param request
	 * @return
	 * cuigeqiang
	 */
	public Long getIdByParentId(HttpServletRequest request);
	
	/**
	 * 加载从表数据
	 * @param pageMap
	 * @param request
	 * cuigeqiang
	 */
	public void loadSlaveData(Map pageMap,HttpServletRequest request);
	
	/**
	 * 更新表单数据
	 * @param request
	 * cuigeqiang
	 */
	public List<Long> updateSlaveForm(HttpServletRequest request);
}
